<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="../include/tag.jsp" %>
<!DOCTYPE html>
<html lang="zh">
<head>
    <title>操作日志</title>
    <link rel="stylesheet" href="${ctx}/css/common/list.css">
    <link rel="stylesheet" href="${ctx}/css/common/table.css">
    <link rel="stylesheet" href="${ctx}/css/ui/activity/member_act_list.css">
    <%@include file="../include/commonFile.jsp" %>
</head>
<body>
<!--头部-->
<%@include file="../include/header.jsp" %>
<div class="index-outside">
    <%@include file="../include/sidebar.jsp" %>
    <!--内容-->
    <section>
        <div class="section-main">
            <form class="layui-form" action="${ctx}/log/event/behavior/list.do" id="myForm" method="post">
                <input type="hidden" name="pageNo" id="pageNo"/>
                <div class="f-search-bar">
                    <div class="search-container">
                        <ul class="search-form-content">
                            <li class="form-item-inline" style="margin-left: 14px;">
                                <label class="search-form-lable">操作者</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="operator" autocomplete="off" class="layui-input" style="width: 195px"
                                           value="${logEventQuery.operator}" placeholder="操作者">
                                </div>
                            </li>
                            <li class="form-item-inline"><label class="search-form-lable">模块名</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="moduleName" autocomplete="off" class="layui-input" style="width: 195px"
                                           value="${logEventQuery.moduleName}" placeholder="模块名">
                                </div>
                            </li>
                            <li class="form-item-inline"><label class="search-form-lable">行为类型</label>
                                <div class="layui-input-inline">
                                    <select name="behaviorType">
                                        <option value="">请选择</option>
                                        <c:forEach var="type" items="${behaviorType}">
                                            <option value="${type.key}"  <c:if test="${type.key == logEventQuery.behaviorType}">selected</c:if>>${type.value}</option>
                                        </c:forEach>
                                    </select>
                                </div>
                            </li>
                        </ul>
                        <ul class="search-form-content">
                            <li class="form-item-inline">
                                <label class="search-form-lable">请求方法</label>
                                <div class="layui-input-inline">
                                    <select name="requestMethod">
                                        <option value="">全部</option>
                                        <option value="POST" <c:if test="${logEventQuery.requestMethod == 'POST'}">selected</c:if>>POST</option>
                                        <option value="GET" <c:if test="${logEventQuery.requestMethod == 'GET'}">selected</c:if>>GET</option>
                                    </select>
                                </div>
                            </li>
                            <li class="form-item-inline">
                                <label class="search-form-lable" style="margin-left: -13px;">ip地址</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="remoteAddr" autocomplete="off" class="layui-input" style="width: 195px"
                                           value="${logEventQuery.remoteAddr}" placeholder="ip地址">
                                </div>
                            </li>
                            <li class="form-item-inline"><label class="search-form-lable">浏览器</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="browser" autocomplete="off" class="layui-input"  style="width: 195px"
                                           value="${logEventQuery.browser}" placeholder="浏览器">
                                </div>
                            </li>
                        </ul>
                        <ul class="search-form-content">
                            <li class="form-item-inline">
                                <label class="search-form-lable">请求链接</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="requestUrl" autocomplete="off" class="layui-input" style="width: 195px"
                                           value="${logEventQuery.requestUrl}" placeholder="请求链接">
                                </div>
                            </li>
                            <li class="form-item-inline">
                                <label class="search-form-lable" style="margin-left: -13px;">类名</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="callerClass" autocomplete="off" class="layui-input" style="width: 195px"
                                           value="${logEventQuery.callerClass}" placeholder="类名">
                                </div>
                            </li>
                            <li class="form-item-inline">
                                <label class="search-form-lable">方法</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="callerMethod" autocomplete="off" class="layui-input" style="width: 195px"
                                           value="${logEventQuery.callerMethod}" placeholder="方法">
                                </div>
                            </li>
                        </ul>
                        <ul class="search-form-content">
                            <li class="form-item"><label class="search-form-lable">时间</label>
                                <div class="check-btn-inner">
                                    <a id="all" href="javascript:void(0);"
                                       onclick="setTimeType($(this),0,'#myForm')" ${empty logEventQuery.timeType || logEventQuery.timeType == 0 ? 'class="active"' : ''}>全部</a>
                                    <a href="javascript:void(0);"
                                       onclick="setTimeType($(this),1,'#myForm')" ${logEventQuery.timeType == 1 ? 'class="active"' : ''}>今天</a>
                                    <a href="javascript:void(0);"
                                       onclick="setTimeType($(this),2,'#myForm')" ${logEventQuery.timeType == 2 ? 'class="active"' : ''}>本周内</a>
                                    <a href="javascript:void(0);"
                                       onclick="setTimeType($(this),3,'#myForm')" ${logEventQuery.timeType == 3 ? 'class="active"' : ''}>本月内</a>
                                    <input type="hidden" name="timeType" value="${logEventQuery.timeType}"/>
                                </div>
                                <div class="layui-inline">
                                    <div class="layui-input-inline">
                                        <input class="layui-input" type="text" name="createStart" value="${logEventQuery.createStart}" placeholder="开始日">
                                    </div>
                                    -
                                    <div class="layui-input-inline">
                                        <input class="layui-input" type="text" name="createEnd" value="${logEventQuery.createEnd}" placeholder="截止日">
                                    </div>
                                </div>
                            </li>
                            <li class="form-item-inline">
                                <div class="sub-btns">
                                    <a class="layui-btn layui-btn-danger" href="javascript:submitFunction('#myForm')">查询</a>
                                    <a class="layui-btn layui-btn-normal" href="javascript:resetFunction('#myForm')">重置</a>
                                </div>
                            </li>
                        </ul>
                    </div>
                </div>
            </form>
            <div class="list-content">
                <div class="cl">
                    <table class="layui-table" id="myTable">
                        <colgroup>
                            <col width="170px">
                            <col width="15%">
                            <col width="100px">
                            <col>
                            <col width="100px">
                            <col width="150px">
                            <col width="150px">
                            <col width="100px">
                        </colgroup>
                        <thead>
                        <tr>
                            <th>操作者</th>
                            <th>模块名</th>
                            <th>行为类型</th>
                            <th>请求连接</th>
                            <th>请求方法</th>
                            <th>ip地址</th>
                            <th>时间</th>
                            <th style="text-align: center">展开</th>
                        </tr>
                        </thead>
                        <tbody>
                        <c:forEach var="log" items="${list}">
                            <tr class="info" data-id="${log.id}">
                                <td>${log.operator}</td>
                                <td>${log.moduleName}</td>
                                <td>${log.behaviorType}</td>
                                <td>${log.requestUrl}</td>
                                <td>${log.requestMethod}</td>
                                <td>${log.remoteAddr}</td>
                                <td><fmt:formatDate value="${log.timestmp}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
                                <td>
                                    <div class="option">
                                        <i class="iconfont icon-unfold"></i>
                                        <i class="iconfont icon-fold dis-none"></i>
                                    </div>
                                </td>
                            </tr>
                            <tr class="dis-none info-detail">
                                <td colspan="8">
                                    <div>
                                        <table width="100%" class="childTable layui-table" lay-skin="row" style="margin: 0px">
                                            <tbody>
                                                <tr>
                                                    <td>所属类名</td>
                                                    <td>${log.callerClass}</td>
                                                </tr>
                                                <tr>
                                                    <td>所属方法名</td>
                                                    <td>${log.callerMethod}</td>
                                                </tr>
                                                <tr>
                                                    <td>参数</td>
                                                    <td>${log.argument}</td>
                                                </tr>
                                                <c:if test="${not empty log.remarks}">
                                                    <tr>
                                                        <td>备注</td>
                                                        <td>${log.remarks}</td>
                                                    </tr>
                                                </c:if>
                                                <tr>
                                                    <td>浏览器</td>
                                                    <td>${log.browser}</td>
                                                </tr>
                                                <tr>
                                                    <td>操作系统</td>
                                                    <td>${log.operatSystem}</td>
                                                </tr>
                                            </tbody>
                                        </table>
                                    </div>
                                </td>
                            </tr>
                        </c:forEach>
                        </tbody>
                    </table>
                </div>
            </div>
            <div id="page_content" class="page-container"></div>
        </div><!--底部-->
        <%@include file="../include/footer.jsp" %>
    </section>
</div>
<script type="text/javascript" src="${ctx}/script/common/list.js"></script>
<script type="text/javascript" src="${ctx}/script/common/table_option.js"></script>
<script type="text/javascript">
    $(function () {
        //加载分页
        loadPageNew({elem: 'page_content', totalCount: '${page.totalCount}', limit: '${page.limit}', page: '${page.page}'});
        layui.use(['laydate'], function () {
            var laydate = layui.laydate;
            // 查询发布日期
            var start = {
                elem: 'input[name=createStart]'
            };

            var end = {
                elem: 'input[name=createEnd]'
            };
            laydate.render(start);
            laydate.render(end);
        });

        $('#myTable').delegate('.option', 'click', function (e) {
            var info = $(this).closest('.info');
            if (!info.hasClass('active')) {//打开
                /*$('.info').removeClass('active');
                $(".info-detail").removeClass('dis-block');*/
                info.toggleClass('active');
                $(info).next(".info-detail").addClass('dis-block');
            } else {
                info.toggleClass('active');
                $(info).next(".info-detail").removeClass('dis-block');
            }
        });
    })
</script>
<script type="text/javascript">
    txz.initHeader({
        nav:[{
            name: '操作日志',
            curr: true
        }],
        info:'<span class="f12">共<b id="totalCount">${page.totalCount}</b>条记录</span>'
    });
</script>
</body>
</html>